package com.ruoyi;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 启动程序
 *
 * @author ruoyi
 */
@Slf4j
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{
    public static void main(String[] args) throws UnknownHostException {
        System.setProperty("spring.devtools.restart.enabled", "false");
		ConfigurableApplicationContext run = SpringApplication.run(RuoYiApplication.class, args);
		ConfigurableEnvironment environment = run.getEnvironment();
		System.out.println("当前环境："+environment.getProperty("spring.profiles.active"));
		String ip = InetAddress.getLocalHost().getHostAddress();
		String port = environment.getProperty("server.port");
		String path = environment.getProperty("server.servlet.context-path");
		log.info("\n----------------------------------------------------------\n" +
			"Application  is running! Access URLs:\n\t" +
			"Local: http://localhost:" + port + path + "\n" +
			"External:http://" + ip + ":" + port + path + "\n" +
			"----------------------------------------------------------");
		System.out.println("(♥◠‿◠)ﾉﾞ  RuoYi-Vue-Plus启动成功   ლ(´ڡ`ლ)ﾞ");
    }
}
